using System;
using System.Windows;
using System.Data;
using System.Xml;
using System.Configuration;
using System.Reflection;
using System.IO;
using ViewOn.Kernel;
using ViewOn.Helper.Memory;
using ViewOn.AddInsHostContract;
using ViewOnCore.HostContract;

namespace ViewOn
{
    /// <summary>
    /// The ViewOn.tv application.
    /// </summary>
    public partial class App : System.Windows.Application
    {   
        static public SplashScreen SplashScreen;
        static public string[] StartupArgs;
        
        // http://learnwpf.com/Posts/Post.aspx?postId=a5643949-ab80-47f9-93c8-f5e8e5782d34
        // Allow SmartAssembly to handle every kind of error.
        [System.STAThreadAttribute()]
        static void Main()
        {
//            Host.SettingsService.CurrentCulture = Host.SettingsService.CurrentCulture;
            AppDomain.CurrentDomain.SetupInformation.ShadowCopyFiles = "false";

            //---- Show
            SplashScreen = new SplashScreen("_images/SplashScreen.png");
            SplashScreen.Show(false);

            App app = new App();
            app.InitializeComponent();
            app.Run();
        }

        void App_Startup(object sender, StartupEventArgs e)
        {
            StartupArgs = e.Args;

            //---- Handle application exit
            this.Exit += new ExitEventHandler(App_Exit);
        }

        void App_Exit(object sender, ExitEventArgs e)
        {
            ((ViewOnHostContract)Host.Instance).ApplicationExit();
            AddIns.AddInStore.ApplicationExit();
        }

    }
}